<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include("layouts.common.head")
<!-- Fonts -->
    <link href="{{asset('static/css/personal/common.css')}}" rel="stylesheet" type="text/css">
    <link href="{{ asset('static/css/personal/personal_user.css') }}" rel="stylesheet">
    <link href="{{asset('static/css/personal/personal_ajax_dialog.css')}}" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <style>
        html {
            overflow-y: scroll;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="us-top">
        <div class="us-main">
            <div class="us-top-box">
                <form id="ajax_search_location"
                      action="{:U('ajaxCommon/ajax_search_location',array('type'=>'QS_jobslist'))}" method="get">
                    <div class="input-box"><input type="text" name="key" data-original="请输入关键字" value=""
                                                  placeholder="请输入关键字" autocomplete="off"></div>
                    <div class="se-btn"><input type="submit" value="搜 索"></div>
                    <div class="clear"></div>
                </form>
            </div>
        </div>
    </div>
    <div class="user_main">
        @include('member.layouts.index_left_nav')
        <div class="mainbox">
            <!--职位切换卡 -->
            <div class="tab">
                <a class="li select">账号安全</a>
                <a class="li J_hoverbut" href="{:U('personal/user_avatar')}">我的头像</a>
                <a class="li J_hoverbut" href="{:U('personal/resume_privacy')}">屏蔽企业</a>
                <a class="li J_hoverbut" href="{:U('personal/user_loginlog')}">登录日志</a>
                <div class="clear"></div>
            </div>
            <!--切换卡结束 -->
            <div class="userprofile J_focus">
                <div class="uleft">
                    <form id="" class="" action="{:U('personal/user_info')}" method="post">
                        <div class="td1"><span>&nbsp;</span>姓名：</div>
                        <div class="td2">
                            <div class="input_245_34_div2 J_tooltip J_listitme_parent">
                                <input name="realname" id="realname" type="text" dir="no_focus" class="inputst"
                                       value="{$userprofile.realname}"/>
                                <div class="righttxt J_listitme_text">
                                    完全公开
                                </div>
                                <div class="dropdowbox3 J_tooltip_menu">
                                    <div class="dropdow_inner16">
                                        <ul class="nav_box">
                                            <li><a class="J_listitme" href="javascript:;" data-code="1">完全公开</a></li>
                                            <li><a class="J_listitme" href="javascript:;" data-code="2">显示编号</a></li>
                                            <li><a class="J_listitme" href="javascript:;" data-code="3">隐藏名字</a></li>
                                        </ul>
                                    </div>
                                </div>
                                <input class="J_listitme_code" name="display_name" id="display_name" type="hidden"
                                       value="{$userprofile.display_name}"/>
                            </div>
                        </div>
                        <div class="td1"><span>&nbsp;</span>性别：</div>
                        <div class="td2">
                            <div class="sex_radio_list J_radioitme_parent">
                                <div class="n  J_radioitme" data-code="1">男
                            </div>
                            <div class="w <if condition=" $userprofile[
                            'sex'] eq 2">checked</if> J_radioitme" data-code="2">女
                        </div>
                        <div class="clear"></div>
                        <input class="J_radioitme_code" name="sex" id="sex" type="hidden" value="{$userprofile.sex}"/>
                </div>
            </div>
            <div class="td1"><span>&nbsp;</span>出生年份：</div>
            <div class="td2">
                <div class="input_245_34_div J_hoverinput J_dropdown J_listitme_parent">
                    <span class="J_listitme_text">{$userprofile.birthday|default='请选择'}</span>
                    <div class="dropdowbox5 J_dropdown_menu">
                        <div class="dropdow_inner5">
                            <ul class="nav_box J_birthdy">
                                <div class="J_birthday_box active"></div>
                                <div class="J_birthday_box"></div>
                                <div class="J_birthday_box"></div>
                            </ul>
                            <a href="javascript:;" class="prev J_birthday_prev"></a>
                            <a href="javascript:;" class="next J_birthday_next"></a>
                        </div>
                    </div>
                    <input class="J_listitme_code" name="birthday" id="birthday" type="hidden"
                           value="{$userprofile.birthday}"/>
                </div>
            </div>
            <div class="td1">现居住地：</div>
            <div class="td2">
                <input name="residence" id="residence" type="text" class="input_245_34"
                       value="{$userprofile.residence}"/>
            </div>
            <div class="td1"><span>&nbsp;</span>最高学历：</div>
            <div class="td2">
                <div class="input_245_34_div J_hoverinput J_dropdown J_listitme_parent">
                    <span class="J_listitme_text">{$userprofile.education_cn|default='请选择'}</span>
                    <div class="dropdowbox4 J_dropdown_menu">
                        <div class="dropdow_inner4">
                            <ul class="nav_box">
                                <volist name="education" id="education">
                                    <li><a class="J_listitme" href="javascript:;" data-code="{$key}">{$education}</a>
                                    </li>
                                </volist>
                            </ul>
                        </div>
                    </div>
                    <input class="J_listitme_code" name="education" id="education" type="hidden"
                           value="{$userprofile.education}"/>
                </div>
            </div>
            <div class="td1"> 所学专业：</div>
            <div class="td2">
                <div class="input_245_34_div1 J_hoverinput" id="J_showmodal_major" data-title="请选择所学专业"
                     data-multiple="false" data-maxnum="3" data-width="520">
                    <span title="" class="result J_resuletitle_major">{$userprofile.major_cn|default='请选择'}</span>
                    <input class="J_resultcode_major" name="major" id="major" type="hidden"
                           value="{$userprofile.major}"/>
                    <div class="clear"></div>
                </div>
            </div>
            <div class="td1"><span>&nbsp;</span>工作经验：</div>
            <div class="td2">
                <div class="input_245_34_div J_hoverinput J_dropdown J_listitme_parent">
                    <span class="J_listitme_text">{$userprofile.experience_cn|default='请选择'}</span>
                    <div class="dropdowbox4 J_dropdown_menu">
                        <div class="dropdow_inner4">
                            <ul class="nav_box">
                                <volist name="experience" id="experience">
                                    <li><a class="J_listitme" href="javascript:;" data-code="{$key}">{$experience}</a>
                                    </li>
                                </volist>
                            </ul>
                        </div>
                    </div>
                    <input class="J_listitme_code" name="experience" id="experience" type="hidden"
                           value="{$userprofile.experience}"/>
                </div>
            </div>
            <div class="td1"><span>&nbsp;</span>手机：</div>
            <div class="td2">
                <if condition="$visitor['mobile_audit']">
                    <input disabled name="phone" id="phone" type="text" class="input_245_34" value="{$visitor.mobile}"/>
                    <span class="link_blue"><a id="J_auth_mobile" href="javascript:;">修改</a></span>
                    <else/>
                    <input name="phone" id="phone" type="text" class="input_245_34" value="{$userprofile.phone}"/>
                </if>
            </div>
            <div class="td1"><span>&nbsp;</span>邮箱：</div>
            <div class="td2">
                <if condition="$visitor['email_audit']">
                    <input disabled name="email" id="email" type="text" class="input_245_34" value="{$visitor.email}"/>
                    <span class="link_blue"><a id="J_auth_email" href="javascript:;">修改</a></span>
                    <else/>
                    <div class="reg-form-content">
                        <input name="email" id="email" type="text" value="{$userprofile.email}"
                               class="input_245_34 inputElem"/>
                    </div>
                </if>
            </div>
            <div class="td1">身高：</div>
            <div class="td2">
                <div class="input_245_34_div3">
                    <input name="height" id="height" type="text" dir="no_focus" class="inputst" value="<if condition="
                           $userprofile['height'] gt 0">{$userprofile.height}</if>"/>
                    <div class="righttxt">CM</div>
                </div>
            </div>
            <div class="td1">籍贯：</div>
            <div class="td2">
                <input name="householdaddress" id="householdaddress" type="text" class="input_245_34"
                       value="{$userprofile.householdaddress}"/>
            </div>
            <div class="td1">婚姻状况：</div>
            <div class="td2">
                <div class="radio_list J_radioitme_parent">
                    <div class="rli J_radioitme <if condition=" $userprofile[
                    'marriage'] eq 1">checked</if>" data-code="1">未婚
                </div>
                <div class="rli J_radioitme <if condition=" $userprofile[
                'marriage'] eq 2">checked</if>" data-code="2">已婚
            </div>
            <div class="rli J_radioitme <if condition=" $userprofile[
            'marriage'] eq 3">checked</if>" data-code="3">保密
        </div>
        <div class="clear"></div>
        <input class="J_radioitme_code" name="marriage" id="marriage" type="hidden" value="{$userprofile.marriage}"/>
    </div>
</div>
<div class="td1">QQ：</div>
<div class="td2">
    <input name="qq" id="qq" type="text" class="input_245_34" value="{$userprofile.qq}"/>
</div>
<div class="td1">微信号：</div>
<div class="td2">
    <input name="weixin" id="weixin" type="text" class="input_245_34" value="{$userprofile.weixin}"/>
</div>
<div class="clear"></div>
<div class="butbox"><input type="button" id="J_savebase" class="but_blue_245 J_hoverbut" value="保存"/></div>
</form>
</div>
<div class="uright">
    <div class="photobox">
        <div class="photo" onclick="javascript:location.href='{:U('personal/user_avatar')}'"><img border="0" width="150"
                                                                                                  width="150"
                                                                                                  src="{$userprofile['avatar']}?{:time()}">
        </div>
        <div class="txt"><label><input name="photo_display" id="photo_display" type="checkbox" value="2"
                <if condition="$userprofile['photo_display'] eq 2">checked="checked"</if>
                />&nbsp;头像不公开</label></div>
    </div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
<include file="index_footer"/>

</div>
<!--word简历结束 -->


<div class="clear"></div>
<script type="text/javascript" src="{{asset('static/js/jquery.disappear.tooltip.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.dropdown.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.listitem.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.modal.userselectlayer.js')}}"></script>

<script>
    let QS_trade = ["1,消防", "2,安监"];
    let QS_jobtag = ["145,环境好", "146,年终奖", "147,双休", "148,五险一金", "149,加班费", "150,朝九晚五", "151,交通方便", "152,加班补助", "153,包食宿", "154,管理规范", "155,有提成", "156,全勤奖", "157,有年假", "158,专车接送", "159,有补助", "160,晋升快", "161,车贴", "162,房贴", "164,技术培训", "165,旅游"]
    //切换
    $('.J_showitems').live('click', function (e) {
        $('.J_itemsmenu').hide();
        $('.items').show();
        let $parentDom = $(this).closest('.J_itemsbox');
        $(this).closest('.items').hide();
        $parentDom.find('.J_itemsmenu').show();
    });
    // 取消通用
    $('.J_closeitems').live('click', function (e) {
        let $parentDom = $(this).closest('.J_itemsbox');
        $(this).closest('.J_itemsmenu').hide();
        $parentDom.find('.items').show();
    });
    // 保存基本信息
    $('.J_saveitems_baseinfo').live('click', function (e) {
        // 提交之前先验证
        let name = $.trim($('#name').val());
        let sex = $.trim($('#sex').val());
        let birth = $.trim($('#birth').val());
        let house = $.trim($('#house').val());
        let education = $.trim($('#education').val());
        let experience = $.trim($('#experience').val());
        let telephone = $.trim($('#telephone').val());
        if (name === "") {
            disapperTooltip("remind", "请填写姓名");
            return false;
        }
        if (sex === "") {
            disapperTooltip("remind", "请选择性别");
            return false;
        }
        if (birth === "") {
            disapperTooltip("remind", "请选择出生年份");
            return false;
        }
        if (house !== "" && house.length > 20) {
            disapperTooltip("remind", "现居住地应在1~20个字内");
            return false;
        }
        if (education === "") {
            disapperTooltip("remind", "请选择学历");
            return false;
        }
        if (experience === "") {
            disapperTooltip("remind", "请选择工作经验");
            return false;
        }

        $('.J_saveitems_baseinfo').val('保存中...').addClass('btn_disabled').prop('disabled', !0);
        // 提交表单
        $.ajax({
            url: "{{url('member/ajax_save_basic_info')}}",
            type: 'POST',
            dataType: 'json',
            data: {
                name: name,
                sex: sex,
                birth: birth,
                house: house,
                education: education,
                experience: experience,
                telephone: telephone,
            }
        }).done(function (res) {
            if (res.status === 1) {
                // 如果操作成功就同步修改的值
                $('[data-sub="name"]').text($('#name').val());
                $('[data-sub="sex"]').text($('#email').val());
                // 计算年龄
                let cYear = parseInt($('#birth').val());
                let nowDate = new Date();
                let nowYear = nowDate.getFullYear();
                let ageNum = parseInt(nowYear - cYear);
                $('[data-sub="birth"]').text(ageNum);
                $('[data-sub="education"]').text($('.for_education').text());
                $('[data-sub="experience"]').text($('.for_experience').text());
                //籍贯
                $('[data-sub="house"]').text($('#house').val());
                $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
                // 关闭操作框
                let $parentDom = $('.J_saveitems_baseinfo').closest('.J_itemsbox');
                $('.J_saveitems_baseinfo').closest('.J_itemsmenu').hide();
                $parentDom.find('.items').show();
            } else {
                $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
                disapperTooltip("remind", "更新失败请重新提交");
            }
        }).fail(function () {
            $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
            disapperTooltip("remind", "更新失败请重新提交");
        });
    });
    // 保存求职意向
    $('.J_saveitems_intention').live('click', function (e) {
        // 提交之前先验证
        let current = $.trim($('#current').val());
        let nature = $.trim($('#nature').val());
        let trade = $.trim($('#trade').val());
        let intentionJobs = $.trim($('#intention_jobs_id').val());
        let district = $.trim($('#district').val());
        let wageValue = $.trim($('#wage').val());
        if (current == "") {
            disapperTooltip("remind", "请选择目前状态");
            return false;
        }
        if (natureValue == "") {
            disapperTooltip("remind", "请选择工作性质");
            return false;
        }
        if (intentionJobsValue == "") {
            disapperTooltip("remind", "请选择期望职位");
            return false;
        }
        if (districtValue == "") {
            disapperTooltip("remind", "请选择工作地区");
            return false;
        }
        if (wageValue == "") {
            disapperTooltip("remind", "请选择期望薪资");
            return false;
        }
        // 提交表单
        $.ajax({
            url: "{:U('Personal/ajax_save_basic')}",
            type: 'POST',
            dataType: 'json',
            data: {
                pid: pid,
                current: currentValue,
                nature: natureValue,
                trade: tradeValue,
                intention_jobs_id: intentionJobsValue,
                district: districtValue,
                wage: wageValue
            }
        })
            .done(function (data) {
                if (parseInt(data.status)) {
                    // 如果操作成功就同步修改的值
                    $('[data-sub="current"]').text($('.for_current').text());
                    $('[data-sub="nature"]').text($('.for_nature.checked').text());
                    $('[data-sub="trade"]').text($('.for_trade').text());
                    $('[data-sub="district"]').text($('.for_district').text());
                    $('[data-sub="wage"]').text($('.for_wage').text());

                    // 关闭操作框
                    let $parentDom = $('.J_saveitems_intention').closest('.J_itemsbox');
                    $('.J_saveitems_intention').closest('.J_itemsmenu').hide();
                    $parentDom.find('.items').show();
                    if (data.data != '') {
                        disapperTooltip("remind", data.msg);
                    } else {
                        $('[data-sub="intention_jobs"]').text($('.for_intention_jobs').text());
                    }
                } else {
                    disapperTooltip("remind", data.msg);
                }
            })
            .fail(function () {
                disapperTooltip("remind", "更新失败请重新提交");
            });
    });
    // 添加自我描述 保存
    $('.J_saveitems_specialty').live('click', function (e) {
        // 提交之前先验证
        let specialtyValue = $.trim($('#specialty').val());
        if (specialtyValue == "") {
            disapperTooltip("remind", "请填写自我描述");
            return false;
        }

        // 提交表单
        $.ajax({
            url: "/member/ajax_save_specialty",
            type: 'POST',
            dataType: 'json',
            data: {specialty: specialtyValue}
        }).done(function (data) {
            if (parseInt(data.status)) {
                let htmlVal = $('#specialty').val();
                $('.specialty_box').removeClass('empty font_gray9').addClass('describe font_gray6').text(htmlVal);
                // 关闭操作框
                let $parentDom = $('.J_saveitems_specialty').closest('.J_itemsbox');
                $('.J_saveitems_specialty').closest('.J_itemsmenu').hide();
                $parentDom.find('.items').show();
                check_complete_percent_allowance();
            } else {
                disapperTooltip("remind", data.msg);
            }
        })
            .fail(function () {
                disapperTooltip("remind", "更新失败请重新提交");
            });
    });
</script>
</body>
</html>
